 package com.cxl.pattern.iterator;
 
 public class BookShelfIterator
   implements Iterator
 {
   private BookShelf bookshelf;
   private int index;
 
   public BookShelfIterator(BookShelf bookshelf)
   {
     this.bookshelf = bookshelf;
     this.index = 0;
   }
 
   public boolean hasNext()
   {
     if (this.index < this.bookshelf.getLength()) {
       return true;
     }
 
     return false;
   }
 
   public Object next()
   {
     Book book = this.bookshelf.getBookAt(this.index);
     this.index += 1;
     return book;
   }
 }

/* Location:           E:\work\eclipse3.6_\workspace\design_pattern\
 * Qualified Name:     com.cxl.pattern.iterator.BookShelfIterator
 * JD-Core Version:    0.6.1
 */